Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PDO] fix: Explicitly convert PDO queries to utf-8 #296

Merged
merged 6 commits into from
Oct 2, 2024

Conversation

John98Zakaria
Copy link
Contributor

@John98Zakaria John98Zakaria commented Sep 19, 2024

This explicitly converts queries to utf-8 to allow them to be sent over grpc

I am not sure what the consequences are for Chinese or Arabic queries 😅 or any other non Latin alphabet language

Closes: open-telemetry/opentelemetry-php#1381

@John98Zakaria John98Zakaria requested a review from a team as a code owner September 19, 2024 12:15
Copy link

welcome bot commented Sep 19, 2024

Thanks for opening your first pull request! If you haven't yet signed our Contributor License Agreement (CLA), then please do so that we can accept your contribution. A link should appear shortly in this PR if you have not already signed one.

Copy link

linux-foundation-easycla bot commented Sep 19, 2024

CLA Signed

The committers listed above are authorized under a signed CLA.

@John98Zakaria John98Zakaria changed the title Explicitly convert PDO queries to utf-8 fix: Explicitly convert PDO queries to utf-8 Sep 19, 2024
Copy link

codecov bot commented Sep 25, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 82.68%. Comparing base (e2ba8fa) to head (7b52281).
Report is 2 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff            @@
##               main     #296   +/-   ##
=========================================
  Coverage     82.68%   82.68%           
  Complexity      949      949           
=========================================
  Files            89       89           
  Lines          3807     3807           
=========================================
  Hits           3148     3148           
  Misses          659      659           
Flag Coverage Δ
Aws 85.75% <ø> (ø)
Context/Swoole 0.00% <ø> (ø)
Instrumentation/CodeIgniter 73.94% <ø> (ø)
Instrumentation/ExtAmqp 89.58% <ø> (ø)
Instrumentation/Guzzle 69.73% <ø> (ø)
Instrumentation/HttpAsyncClient 81.33% <ø> (ø)
Instrumentation/IO 70.90% <ø> (ø)
Instrumentation/MongoDB 77.33% <ø> (ø)
Instrumentation/OpenAIPHP 86.82% <ø> (ø)
Instrumentation/PDO 89.56% <100.00%> (ø)
Instrumentation/Psr14 78.12% <ø> (ø)
Instrumentation/Psr15 93.50% <ø> (ø)
Instrumentation/Psr18 82.08% <ø> (ø)
Instrumentation/Slim 86.95% <ø> (ø)
Instrumentation/Symfony 89.03% <ø> (ø)
Instrumentation/Yii 77.77% <ø> (ø)
Logs/Monolog 100.00% <ø> (ø)
Propagation/ServerTiming 100.00% <ø> (ø)
Propagation/TraceResponse 100.00% <ø> (ø)
ResourceDetectors/Container 93.02% <ø> (ø)
Sampler/RuleBased 32.14% <ø> (ø)
Shims/OpenTracing 92.99% <ø> (ø)
Symfony 88.20% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/Instrumentation/PDO/src/PDOInstrumentation.php 95.83% <100.00%> (ø)

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e2ba8fa...7b52281. Read the comment docs.

@John98Zakaria John98Zakaria changed the title fix: Explicitly convert PDO queries to utf-8 [PDO] fix: Explicitly convert PDO queries to utf-8 Sep 26, 2024
@John98Zakaria
Copy link
Contributor Author

I fixed the php-stan warning for my code. 🙏

composer.json Outdated
@@ -7,7 +7,8 @@
"prefer-stable": true,
"require": {
"php": "^7.4 || ^8.0",
"ext-json": "*"
"ext-json": "*",
"ext-mbstring": "*"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we rely on there being a polyfill available here (https://github.com/open-telemetry/opentelemetry-php/blob/main/src/API/composer.json#L23) and move mbstring to a suggestion (if it's better/more performant/etc) ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Such changes should also be added to src/Instrumentation/PDO/composer.json 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • I removed the requirement from the root composer json

  • Added symfony/polyfill-mbstring as a requirement

  • Added ext-mbstring the extension as a suggested

@brettmc
Copy link
Collaborator

brettmc commented Sep 26, 2024

We have some integration tests for this package, could you please take a look and see if they can be enhanced to exercise this functionality?

@John98Zakaria
Copy link
Contributor Author

I added tests that check for utf-8 encoding

@brettmc brettmc merged commit 3dd4f06 into open-telemetry:main Oct 2, 2024
95 of 120 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants